import request from '@/utils/request'

// 查询商品SPU列表
export function listProductSpu(query) {
  return request({
    url: '/product/productSpu/list',
    method: 'get',
    params: query
  })
}

// 查询商品SPU详细
export function getProductSpu(id) {
  return request({
    url: '/product/productSpu/' + id,
    method: 'get'
  })
}

// 查询SPU及其SKU信息
export function getSpuWithSkuBySpuId(spuId) {
  return request({
    url: `/product/productSpu/${spuId}/withSku`,
    method: 'get'
  })
}

// 新增商品SPU
export function addProductSpu(data) {
  return request({
    url: '/product/productSpu',
    method: 'post',
    data: data
  })
}

// 修改商品SPU
export function updateProductSpu(data) {
  return request({
    url: '/product/productSpu',
    method: 'put',
    data: data
  })
}

// 删除商品SPU
export function delProductSpu(id) {
  return request({
    url: '/product/productSpu/' + id,
    method: 'delete'
  })
}